package cn.edu.neusoft.model.mapper;

import cn.edu.neusoft.model.bean.Car;
import cn.edu.neusoft.model.bean.CarInfo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Component;

@Mapper
public interface CarInfoMapper {
    // 插入CarInfo对象到数据库
    @Insert("INSERT INTO car_info (id, car_code, car_num, car_num_color, car_type, car_brand, car_color, " +
            "car_status, owner_id, owner_name, owner_code, park_type, list_type, create_time, create_user, " +
            "update_time, department_id, department_type, department_name) " +
            "VALUES (#{id}, #{carCode}, #{carNum}, #{carNumColor}, #{carType}, #{carBrand}, #{carColor}, " +
            "#{carStatus}, #{ownerId}, #{ownerName}, #{ownerCode}, #{parkType}, #{listType}, #{createTime}, " +
            "#{createUser}, #{updateTime}, #{departmentId}, #{departmentType}, #{departmentName})")
    void insertCarInfo( CarInfo carInfo);

    // 清空car_info表
    @Insert("TRUNCATE TABLE car_info")
    void truncateCarInfoTable();
}